﻿<%@ Control Language="C#"  %>
<%@ Register Assembly="Antu.WebControls" Namespace="Antu.WebControls" TagPrefix="CBW" %>

<div style="text-align: center">
    <object id='WebBrowser1' width='0' height='0' classid='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'>
    </object>
    <table class="window_tab_list" style="text-align: center; width: 97%; border-bottom-width: 0px"
        border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td>                        
                <input id="btnPrint" type="button" value="打印" onclick="preview();" />
                <input id="btnBack" type="button" value="返回" onclick="self.close();" />
            </td>
        </tr>
    </table>
    <asp:Literal ID="Literal1" runat="server"></asp:Literal>
</div>

<script type="text/javascript">
    function preview() {
        pagesetup_null();
        bdhtml = window.document.body.innerHTML;
        sprnstr = "<!--STARTPRINT-->";
        eprnstr = "<!--ENDPRINT-->";
        prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) + 17);
        prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));
        window.document.body.innerHTML = prnhtml;

        window.print();
    }
    var hkey_root, hkey_path, hkey_key;
    hkey_root = "HKEY_CURRENT_USER";
    hkey_path = "\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
    /*设置网页打印的页眉页脚为空*/
    function pagesetup_null() {
        try {
            var RegWsh = new ActiveXObject("WScript.Shell");
            hkey_key = "header";
            RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
            hkey_key = "footer";
            RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, "");
        } catch (e) { }
    }
</script>